<template>
    <div>
        <table border="1" width="1000" height="100" align="center" cellspacing="0" cellpadding="10">

            <tr align="center">
                <td>ID</td>
                <td>用户名</td>
                <td>手机号</td>
                <td>邮箱</td>
                <td>创建时间</td>
            </tr>

            <tr align="center">
                <td>{{userlist.id}}</td>
                <td>{{userlist.username}}</td>
                <td>{{userlist.phone}}</td>
                <td>{{userlist.email}}</td>
                <td>{{userlist.create_time}}</td>
            </tr>

        </table>
    </div>
</template>

<script>
export default {
    data() {
        return {
            id:this.$route.query.id,
            userlist:[],
            uid:localStorage.getItem('uid'),
            token:localStorage.getItem('token')
        }
    },

    mounted:function(){

        if (!this.token){
            this.$router.push({path:'/mylogin_two'})
        }

        this.axios.get("http://localhost:8000/userdetail/",{params:{'id':this.id,'uid':this.uid}}).then(res=>{
            
            if (res.data.code == 400){
              this.$toast('您没有该页面的访问权限')
              this.$router.push({path:'/ant_admin'})
            }else{
                // console.log(res.data)
                // this.userlist = res.data

                var u_list = []
                u_list = res.data

                this.axios.get('http://localhost:8000/getuserinfo/',{params:{'id':this.uid}}).then(res=>{
                    if (res.data.auth == 1){
                        console.log(res.data)
                        this.userlist = u_list
                    }else{
                        if (res.data.t == 1){
                            this.$toast('现在时间段您可以访问该页面')
                            console.log('现在时间段您可以访问该页面')
                            this.userlist = u_list
                        }
                        else{
                            this.$toast('您访问该页面的时间未到')
                            console.log('您访问该页面的时间未到')
                            this.$router.push({path:'/ant_index'})
                            console.log(res.data)
                        }
                    }
                })
            }

        })
    }
}
</script>

<style>

</style>